// app 字典的增删改查
import request from '@/utils/request'

// 父项 列表
export function getList(data) {
  return request({
    url: '/union-auth/data-dic/list',
    method: 'post',
    data
  })
}

// 创建 or 修改 父项
export function createOrUpdate(data) {
  return request({
    url: '/union-auth/data-dic/createOrUpdate',
    method: 'post',
    data
  })
}

// 删除父项
export function deleteAppDic(id) {
  return request({
    url: '/union-auth/data-dic/' + id,
    method: 'delete'
  })
}

// ######### 子项操作##############
export function getDicItems(parentId, data) {
  return request({
    url: '/union-auth/data-dic/' +parentId +'/items',
    method: 'post',
    data
  })
}

export function createOrUpdateDicItems(parentId, data) {
  return request({
    url: '/union-auth/data-dic/' +parentId +'/items/createOrUpdate',
    method: 'post',
    data
  })
}

// 删除子项
export function deleteAppDicItems(itemId) {
  return request({
    url: '/union-auth/data-dic/items/' + itemId,
    method: 'delete'
  })
}
